open Base
open Math

type tree and t = tree

type dir = [`H | `V]
type fig = Rect of Dim.t * Color.t

val arm : dir -> t list -> t
val figure : fig -> t
val capture : Event.Id.t -> t -> t

val equal : t -> t -> bool
val to_string : t -> string

module Path : sig
  type t = int list
  val root : t
  val of_list_rev : int list -> t
  val to_string : t -> string
  include Base.Comparable.S with type t := t
end

type update = Path.t * fig
val apply_updates_exn : update Sequence.t -> tree -> tree

module Draw : sig
  type t = Rect of AABB.t * Color.t
  val equal : t -> t -> bool
  val to_string : t -> string
end

val render : tree -> Draw.t Sequence.t
val capture_point : pos:Pos.t -> tree -> Event.Id.t list
